import { T_Device_ClientSide_Cam_NodeDetails } from "@/pages/components/types.ts";

export interface T_Camera_Events_Request_Condition {
  event_name: string;
  event_time: string | number;
  dateRange?: {
    start: number;
    end: number;
  } | null;
}

export interface T_Camera_Events_Request {
  condition: T_Camera_Events_Request_Condition;
}

export interface T_DeviceBindSearch {
  gpu?: string;
  model?: string;
  camera?: string[];
}
export interface T_DeviceVideoSearch {
  camera_id?: string;
  reason_code?: number;
  confirmed?: boolean;
  dateRange?: {
    start?: number;
    end?: number;
  };
  sort?: {
    video_start: string;
  };
}

export interface T_Camera_Statistics_Request {
  condition: T_DeviceVideoSearch;
}

export interface T_GetDevicesBind_Request
  extends T_ServerSidePaginationConfigOnSubmission {
  condition: T_DeviceBindSearch;
}

export interface T_GetDevicesVideo_Request
  extends T_ServerSidePaginationConfigOnSubmission {
  condition: T_DeviceVideoSearch;
}

export interface T_ConfirmedCamera_Request {
  records: Array<string>;
}

export interface T_CameraItem_Api {
  addr: string;
  device_type: number;
  online: boolean;
  timeStamp: number;
  _id: string;
}

export interface T_PipelinesListItem {
  cameraList: string[];
  cameraListFull?: T_Device_ClientSide_Cam_NodeDetails[];
  gpu: string;
  model: string;
  modelName: string;
  timeStamp: number;
  _id: string;
  bindName?: string;
  running?: boolean;
  loading?: boolean;
  tootipVisible?: boolean;
  modelDetails?: Array<{
    create_time: number;
    input_size: string;
    name: string;
    notes: string;
    path: string;
    size: number;
    type: string;
    update_time: number;
    version: string;
    _id: string;
  }>;
}

export interface T_GetRoiBind_Request {
  cameraId: string;
  pipelineId?: string;
}
export interface T_Condition {
  filename?: string;
  dataRange?: null | any;
  sort?: null | any;
  type: number;
}

export interface T_BizParam {
  entriesPerPage: number;
  pageNumber: number;
  condition: T_Condition;
}

export interface T_GetWarnList_Request {
  bizParam: T_BizParam;
}
export interface T_BizParam_ResetId {
  _id: string;
}
export interface T_GetAlarmReset_Request {
  bizParam: T_BizParam_ResetId;
}

interface WarnRecord {
  _id: string;
  addr: string;
  model?: null;
  pipeline: string;
  pipeline_id: string;
  timestamp: number;
  video_start: number;
  video_end: number;
  video: string;
  filename: string;
  size: number;
  event_code: number;
  event_message: string;
  storage_addr: string;
  warn: boolean;
}

interface AlarmListData {
  warnRecords: WarnRecord[];
  totalCount: number;
  entriesPerPage: number;
}

export interface T_GetWarnList_Response {
  code: number;
  message: string;
  currentTime: string;
  data: AlarmListData;
  success: boolean;
  fail: boolean;
}

/** 相机分页对象 */
export interface CameraPageVO {
  /** 相机ID */
  _id: string;
  /** 相机IP地址 */
  addr: string;
  /** rtsp地址 */
  rtsp: string;
  /** 设备类型 */
  device_type: number;
  /** 创建时间 */
  timeStamp?: number;
  /** 在线状态 */
  online: boolean;
  /** 别称 */
  alias?: string;
  /** 父级 */
  parent?: string;
  /** 父级名 */
  parent_name?: string;
}
